package com.small.admin.service.impl;

import com.small.admin.mapper.SequenceMapper;
import com.small.admin.service.SequenceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 作者: fenny
 * 邮箱: 893146555@qq.com
 * 时间: 2017/11/6 18:16
 * 描述: 序列实现
 */
@Service
public class SequenceServiceImpl implements SequenceService {

    @Resource
    private SequenceMapper sequenceMapper;

    @Override
    public long currentValue(String name) {
        sequenceMapper.update(name);
        Long value = sequenceMapper.currentValueByName(name);
        return value==null? 0:value;
    }
}
